/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
 * TrainingBook
 * Copyright (C) Arnaud Duval 2010 <arnaud.duval@gmail.com>
 * 
 * Projects is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Projects is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _T_BMAIN_WINDOW_HPP_
#define _T_BMAIN_WINDOW_HPP_

#include <gtkmm.h>
#include <TrainingBook.hpp>
#include <activity-columns.hpp>
#include <activity-tree-view.hpp>
#include <osm-map-area.hpp>
#include <preferences-dialog.hpp>
#include <Application.hpp>
#include <activity-notebook.hpp>

///@class TBmainWindow
///@brief Defines the main window of the software GUI
class TBmainWindow : public Gtk::Window
{
    public:
        ///@brief Default constructor
        TBmainWindow();
        ///@brief Destructor
        virtual ~TBmainWindow();
    protected:
        // Signal handlers
        ///@brief Click on quit button
        void on_button_quit();
        ///@brief Click on file open nutton
        void on_menu_file_open();
        ///@brief Click on save button
        void on_menu_file_save();
        ///@brief Click on save as button
        void on_menu_file_save_as();
        ///@brief Click on new activity button
        void on_menu_new_activity();
        ///@brief Click on the new user day button
        void on_menu_new_user_day();
        ///@brief Update the tree view with value from the training book
        void update_treeview();
        ///@brief Action when clicking on the treeview
        bool on_treeview_click(GdkEventButton*);
        ///@brief Delete the selected activity in the TreeView
        void on_activity_delete();
        ///@brief Edit the selected activity in the TreeView
        void on_activity_edit();
        ///@brief Click on the preferences menu button
        void on_prefs_click();
        ///@brief Click on the About button
        void on_about_click();
        ///@brief View the track of the selected activity
        void on_activity_view_track();
        ///@brief Analyse the selected activity
        void on_activity_analyse();
        ///@brief Action when loading a SportTrack file
        void on_menu_load_sporttrack();
        ///@brief Action when loading a fitlog file
        void on_menu_load_fitlog();
        ///@brief Action when loading a Garmin file
        void on_menu_load_garmin();
        ///@brief Procedure that configure the menu of the main window
        void ConfigureMenu();
        ///@brief Refresh window
        void Refresh(const unsigned int&, const Glib::ustring&);
        
    private:
        ///@brief The Application
        Application application;
    
        ///@brief The current training book
        TrainingBook currentBook;
        ///@brief The software version
        std::string softVersion;
        ///@brief Current file path
        std::string currentFile;


        ///@brief The main vertical box
        Gtk::VBox mainVBox;
        ///@brief scalable vertical separation between the list of activities and the activity part
        Gtk::VPaned mainVPaned;
        ///@brief The status bar
        Gtk::Statusbar statusBar;
        ///@brief The actiongroup
        Glib::RefPtr<Gtk::ActionGroup> refActionGroup;
        ///@brief The UI manager
        Glib::RefPtr<Gtk::UIManager> refUIManager;
        
        ///@brief The ScrolledWindow containing the listView
        Gtk::ScrolledWindow activityListSW;

        ///@brief The treeview for activity lits
        ActivityTreeView activityListTV;

        ///@brief Area for map display
        //OsmMapArea mapArea;

        ///@brief Notebook to display the activity
        ActivityNotebook aNotebook;

        ///@brief Popup menu for actions in the treeview
        Gtk::Menu popupMenu;

        ///@brief Edited activity
        Activity eActivity;


};

#endif // _T_BMAIN_WINDOW_HPP_
